<?php
class pagina {

	function home()
	{	
		$id1 = mysql_query("SELECT optie FROM instelling where instellingid='1' LIMIT 1");
		$id2 = mysql_fetch_array($id1);
		
		$pagina1 = mysql_query("SELECT content FROM content where paginaid='".$id2['0']."' and weergeven='1' LIMIT 1");
		
		if($pagina1 && mysql_num_rows($pagina1) == 1)
		{
			$pagina2 = mysql_fetch_array($pagina1);
			return $pagina2['0'];
		}else{
			return "pagina/404.php";
		}
	}
	
	function get_pagina($id)
	{	 
		$id1 = mysql_real_escape_string($id);
		if(isset($id1))
		{
			if(is_numeric($id1))
            {
				$pagina1 = mysql_query("SELECT content FROM content where paginaid='".$id1."' and weergeven='1' LIMIT 1");
		
				if($pagina1 && mysql_num_rows($pagina1) == 1)
				{
					$pagina2 = mysql_fetch_array($pagina1);
					return $pagina2['0'];
				}else{
					return "pagina/404.php";
				}
			}else{
				return "pagina/404.php";
			}
		}else{
			return "pagina/404.php";
		}
	}
}